<?php

class Workflow_Helper{
	
	static function getStateChangesByUsername($username,$current_state = "new",$contenttype_id){		
		$workflow_statechanges_table = new WorkflowStatechanges();		
		return $workflow_statechanges_table->getStateChangesByUsername($username,$current_state,$contenttype_id);		
	}
	
	static function isChangeAllowed($content_id,$contenttype_id,$current_state_id,$target_state_id,$username){		
		$statechanges_table = new WorkflowStatechanges();
		return $statechanges_table->isChangeAllowed($content_id,$contenttype_id,$current_state_id,$target_state_id,$username);		
	}
	
	static function getCurrentStateId($content_id,$contenttype_id){
		$states_content_table = new WorkflowStatesContent();
		return $states_content_table->getCurrentStateId($content_id,$contenttype_id);
	}
	
	static function changeState($content_id,$contenttype_id,$state_id,$username,$state_set_on = null){		
		$states_content_table = new WorkflowStatesContent();
		return $states_content_table->changeState($content_id,$contenttype_id,$state_id,$username,$state_set_on);
	}
	
	static function stateChangeMakesContentActive($contenttype_id,$current_state_id,$state_id){
		$statechanges_table = new WorkflowStatechanges();
		return $statechanges_table->stateChangeMakesContentActive($contenttype_id,$current_state_id,$state_id);	
	}
}